package cn.icatw.yygh.task.scheduled;

import cn.icatw.yygh.common.rabbit.constant.MqConst;
import cn.icatw.yygh.common.rabbit.service.RabbitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author icatw
 * @date 2022/2/14
 * @apiNote 定时任务类
 */
@Component
@EnableScheduling
public class ScheduledTask {
    @Autowired
    private RabbitService rabbitService;
    /**
     *每天八点执行就医提醒方法
     * cron表达式，设置执行间隔
     * 0 0 8 * * ?
     * 0/30 * * * * ?
     */
    @Scheduled(cron = "0 0 8 * * ?")
    public void taskPatient(){
        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK,MqConst.ROUTING_TASK_8,"");
    }
}
